const demo = require(process.argv[2])
console.log('running', demo)

let a = demo.test_obj(1e6)
console.log('obj', a)

let b = demo.test_obj_scope(1e6)
console.log('scope', b)

let c = demo.test_obj_escape_scope()
console.log('escape', c)

/*
running {
  test_obj: [Function (anonymous)],
  test_obj_scope: [Function (anonymous)],
  test_obj_escape_scope: [Function (anonymous)]
}
I PrintMem +15 memoryUsage: 'VmRSS:	   36228 kB'
D TestObj +27 1000000
I PrintMem +15 memoryUsage: 'VmRSS:	  147304 kB'
obj [
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {},
  ... 999900 more items
]
I PrintMem +15 memoryUsage: 'VmRSS:	  147412 kB'
D TestObjScope +48 1000000
I PrintMem +15 memoryUsage: 'VmRSS:	  208072 kB'
scope [
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {},
  ... 999900 more items
]
escape {}
*/
